<!DOCTYPE html>
<html lang="zh">
<head>
	<th:block th:include="include :: header('文件上传')" />
	<th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    	<div class="form-group">
                            <label class="font-noraml">文件上传</label>
	                        <div>
					            <input id="fileinput" name="file" type="file" multiple>
					        </div>
                        </div>
                        <hr>
                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var id = [[${id}]]
        var formData = new FormData();
        function submitHandler(){
            if ($("#fileinput")[0].files[0]==null){
                alter("请选择文件");
                return;
            }
            for (var i = 0; i < $("#fileinput")[0].files.length; i++) {
                formData.append("files",$("#fileinput")[0].files[i]);
            }
            formData.append("id",id);
            $.ajax({
                url:'/system/file/uploadFile',
                type:"post",
                data:formData,
                cache: false,
                dataType: 'json',
                processData: false,
                contentType: false,
                success:function (result){
                    $.operate.successCallback(result);
                }
            })
        }

    </script>
</body>
</html>
